package com.atguigu.tingshu.user.client;

import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.user.UserInfo;
import com.atguigu.tingshu.model.user.UserPaidTrack;
import com.atguigu.tingshu.user.client.impl.UserInfoDegradeFeignClient;
import com.atguigu.tingshu.vo.user.UserInfoVo;
import com.atguigu.tingshu.vo.user.UserPaidRecordVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 产品列表API接口
 * </p>
 *
 * @author qy
 */
@FeignClient(value = "service-user", fallback = UserInfoDegradeFeignClient.class)
public interface UserInfoFeignClient {
    @GetMapping("api/user/userInfo/getUserInfoById/{userId}")
    public Result<UserInfoVo> getUserInfoById(@PathVariable("userId") Long userId);


    // 远程调用 获取用户已经购买的声音id列表
// api/user/userInfo/getUserBuyTrackIdList/{userId}/{albumId}
// @Operation(summary = "远程调用根据用户id获取用户已经购买某专辑的的声音id列表")
    @GetMapping("api/user/userInfo/getUserBuyTrackIdList/{userId}/{albumId}")
    public Result<List<UserPaidTrack>> getUserBuyTrackIdList(@PathVariable("userId") Long userId,
                                                             @PathVariable("albumId") Long albumId);

    // api/user/userInfo/isBuyAlbum
    // @Operation(summary = "远程调用根据用户id和albumId判断用户是否购过买该专辑")
    @GetMapping("api/user/userInfo/isBuyAlbum/{userId}/{albumId}")
    public Result<Boolean> isBuyAlbum(@PathVariable("userId") Long userId,
                                      @PathVariable("albumId") Long albumId);
    // 远程调用user服务 保存交易记录 saveUserPaidRecord
    // api/user/userInfo/saveUserPaidRecord
    @PostMapping("api/user/userInfo/saveUserPaidRecord")
    public Result saveUserPaidRecord(@RequestBody UserPaidRecordVo userPaidRecordVo);
}
